00001 <?php 00002 /*--------------------------------------------------------------------------+ 00003 This file is part of eStudy. 00004 news/classes/class.userdatanews.inc.php 00005 - Module group: Datenauszugsmodul News 00006 - Description: Class "UserDataNews" 00007 - Version: $Id: class.userdatanews.inc.php 1465 2009-01-19 14:58:31Z bkasteleiner $ 00008 - Author(s): Philipp Hoffmann <philipp.hoffmann@mni.fh-giessen.de> 00009 - Bjoern Kasteleiner <bjoern.kasteleiner@mni.fh-giessen.de> 00010 - Bjoern Rathjens <bjoern.rathjens@mni.fh-giessen.de> 00011 +---------------------------------------------------------------------------+ 00012 This program is free software; you can redistribute it and/or 00013 modify it under the terms of the GNU General Public License 00014 as published by the Free Software Foundation; either version 2 00015 of the License, or any later version. 00016 +---------------------------------------------------------------------------+ 00017 This program is distributed in the hope that it will be useful, 00018 but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 GNU General Public License for more details. 00021 You should have received a copy of the GNU General Public License 00022 along with this program; if not, write to the Free Software 00023 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00024 +--------------------------------------------------------------------------*/ 00025 00026 require_once('../user/classes/class.userdataadapter.inc.php'); 00027 00031 class UserDataNews extends UserDataAdapter { 00032 00033 private $userID; 00034 00035 private $data; 00036 00037 00041 public function getUserData($userID) { 00042 $this->userID = $userID; 00043 $this->data = array(); 00044 00045 $this->getNews(); 00046 00047 return $this->data; 00048 } 00049 00050 private function getNews() { 00051 $query = 'SELECT id, course_id, title, text, date_gen' 00052 .' FROM announcements WHERE user_id='.$this->userID 00053 .' ORDER BY date_gen'; 00054 $result = self::executeQuery($query); 00055 00056 foreach($result as $data) { 00057 $this->data[] = array( 00058 self::ID => $data['id'], 00059 self::DATE => $data['date_gen'], 00060 self::COURSE => $data['course_id'], 00061 self::HINT => 'Mitteilung', 00062 self::CONTENT => '[b]Überschrift:[/b] ' 00063 .'[url='.self::getBaseURL().'/announcement/announcement.php?show=all&changeToCourse='.$data['course_id'].'#announcement'.$data['id'].']'.$data['title'].'[/url]'."\n" 00064 .$data['text'] 00065 ); 00066 } 00067 } 00068 00069 } 00070 ?>
1.5.5